--- ROLES ---
use tesoreria
go

-- -------------------
-- - TABLA: Rol ---
-- -------------------
IF  EXISTS (SELECT * FROM sysobjects WHERE name = 'Rol' AND type in ('U'))
	DROP TABLE Rol
GO
CREATE TABLE dbo.Rol(
	Codigo int NOT NULL,
	Descripcion varchar(50) NOT NULL,
	CONSTRAINT PK_Rol PRIMARY KEY CLUSTERED  ( Codigo ASC  ) 
)
GO

INSERT INTO Rol VALUES(1, 'Administrador')
INSERT INTO Rol VALUES(2, 'Cajero')
INSERT INTO Rol VALUES(3, 'Contador')
INSERT INTO Rol VALUES(4, 'Supervisor de operaciones')
INSERT INTO Rol VALUES(5, 'Funcionario')
INSERT INTO Rol VALUES(6, 'Soporte')

-- --------------------------------
-- - usp_Rol_SEL_x_codigo ---
-- --------------------------------
if exists(select * from sysobjects where name = 'usp_Rol_SEL_x_codigo' and type = 'P')
	drop procedure usp_Rol_SEL_x_codigo
GO
create procedure dbo.usp_Rol_SEL_x_codigo
(
	@Codigo int
)
as

select
	 Codigo
	,Descripcion
from
	Rol
where
	Codigo = @Codigo
GO

-- -------------------------
-- - usp_Rol_SEL ---
-- -------------------------
if exists(select * from sysobjects where name = 'usp_Rol_SEL' and type = 'P')
	drop procedure usp_Rol_SEL
GO
create procedure dbo.usp_Rol_SEL
as

select
	 Codigo
	,Descripcion
from
	Rol
GO

